home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / lib / xulrunner-1.9.0.14 / chrome / pippki.jar / content / pippki / deletecert.js < prev    next >
Encoding:
Text File  |  2007-11-09  |  4.0 KB  |  122 lines

  1. /* ***** BEGIN LICENSE BLOCK *****
  2.  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  3.  *
  4.  * The contents of this file are subject to the Mozilla Public License Version
  5.  * 1.1 (the "License"); you may not use this file except in compliance with
  6.  * the License. You may obtain a copy of the License at
  7.  * http://www.mozilla.org/MPL/
  8.  *
  9.  * Software distributed under the License is distributed on an "AS IS" basis,
  10.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  11.  * for the specific language governing rights and limitations under the
  12.  * License.
  13.  *
  14.  * The Original Code is mozilla.org code.
  15.  *
  16.  * The Initial Developer of the Original Code is
  17.  * Netscape Communications Corporation.
  18.  * Portions created by the Initial Developer are Copyright (C) 2001
  19.  * the Initial Developer. All Rights Reserved.
  20.  *
  21.  * Contributor(s):
  22.  *   Ian McGreer <mcgreer@netscape.com>
  23.  *
  24.  * Alternatively, the contents of this file may be used under the terms of
  25.  * either the GNU General Public License Version 2 or later (the "GPL"), or
  26.  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  27.  * in which case the provisions of the GPL or the LGPL are applicable instead
  28.  * of those above. If you wish to allow use of your version of this file only
  29.  * under the terms of either the GPL or the LGPL, and not to allow others to
  30.  * use your version of this file under the terms of the MPL, indicate your
  31.  * decision by deleting the provisions above and replace them with the notice
  32.  * and other provisions required by the GPL or the LGPL. If you do not delete
  33.  * the provisions above, a recipient may use your version of this file under
  34.  * the terms of any one of the MPL, the GPL or the LGPL.
  35.  *
  36.  * ***** END LICENSE BLOCK ***** */
  37.  
  38. const nsIX509Cert = Components.interfaces.nsIX509Cert;
  39. const nsX509CertDB = "@mozilla.org/security/x509certdb;1";
  40. const nsIX509CertDB = Components.interfaces.nsIX509CertDB;
  41. const nsIPKIParamBlock = Components.interfaces.nsIPKIParamBlock;
  42. const nsIDialogParamBlock = Components.interfaces.nsIDialogParamBlock;
  43.  
  44. var certdb;
  45. var gParams;
  46.  
  47. function setWindowName()
  48. {
  49.   gParams = window.arguments[0].QueryInterface(nsIDialogParamBlock);
  50.   
  51.   var typeFlag = gParams.GetString(0);
  52.   var numberOfCerts = gParams.GetInt(0);
  53.   
  54.   var bundle = srGetStrBundle("chrome://pippki/locale/pippki.properties");
  55.   var title;
  56.   var confirm;
  57.   var impact;
  58.   
  59.   if(typeFlag == "mine_tab")
  60.   {
  61.      title = bundle.GetStringFromName("deleteUserCertTitle");
  62.      confirm = bundle.GetStringFromName("deleteUserCertConfirm");
  63.      impact = bundle.GetStringFromName("deleteUserCertImpact");
  64.   }
  65.   else if(typeFlag == "websites_tab")
  66.   {
  67.      title = bundle.GetStringFromName("deleteSslCertTitle3");
  68.      confirm = bundle.GetStringFromName("deleteSslCertConfirm3");
  69.      impact = bundle.GetStringFromName("deleteSslCertImpact3");
  70.   }
  71.   else if(typeFlag == "ca_tab")
  72.   {
  73.      title = bundle.GetStringFromName("deleteCaCertTitle");
  74.      confirm = bundle.GetStringFromName("deleteCaCertConfirm");
  75.      impact = bundle.GetStringFromName("deleteCaCertImpactX");
  76.   }
  77.   else if(typeFlag == "others_tab")
  78.   {
  79.      title = bundle.GetStringFromName("deleteEmailCertTitle");
  80.      confirm = bundle.GetStringFromName("deleteEmailCertConfirm");
  81.      impact = bundle.GetStringFromName("deleteEmailCertImpactDesc");
  82.   }
  83.   else if(typeFlag == "orphan_tab")
  84.   {
  85.      title = bundle.GetStringFromName("deleteOrphanCertTitle");
  86.      confirm = bundle.GetStringFromName("deleteOrphanCertConfirm");
  87.      impact = "";
  88.   }
  89.   else
  90.   {
  91.      return;
  92.   }
  93.   var confirReference = document.getElementById('confirm');
  94.   var impactReference = document.getElementById('impact');
  95.   document.title = title;
  96.   
  97.   setText("confirm",confirm);
  98.  
  99.   var box=document.getElementById("certlist");
  100.   var text;
  101.   for(var x=0;x<numberOfCerts;x++)
  102.   {
  103.     text = document.createElement("text");
  104.     text.setAttribute("value", gParams.GetString(x+1));
  105.     box.appendChild(text);
  106.   }
  107.  
  108.   setText("impact",impact);
  109. }
  110.  
  111. function doOK()
  112. {
  113.   gParams.SetInt(1, 1); // means OK
  114.   return true;
  115. }
  116.  
  117. function doCancel()
  118. {
  119.   gParams.SetInt(1, 0); // means CANCEL
  120.   return true;
  121. }
  122.